package com.playjoy.controller;

import com.playjoy.entity.User;
import com.playjoy.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by asus on 2016/10/21.
 */
@RestController
@RequestMapping("/usercontroller")
public class UserController {
    @Autowired
    private SysUserService sysuserservice;

    @RequestMapping("/save")
    public String save() throws Exception {
        User user = new User();
        user.setId(122);
        user.setName("xiaoming");
        sysuserservice.save(user);
        return "ok";
    }
   @RequestMapping(value = "/get/{name}")
    public User getByName(@PathVariable String name)throws Exception{
        return sysuserservice.get(name);
    }

/*
    @RequestMapping(value = "/getname/{name}")
    public SysUser getnameById(@PathVariable String name)throws Exception{
        return sysuserservice.findUser(name);
    }
*/


    @RequestMapping("/aa")
    public String getString()throws Exception{
        return "hello word!zz1";
    }


}